package com.cium.aqie.objectOriented.computer

/**
 * @Function:
 * @Author: aqie
 * @Date: 2019/8/30 15:35
 */
class Computer {
    fun addUSBInputDevice(inputDevice: USBInputDevice){
        //插入输入设备
        println("add usb input device: $inputDevice")
    }

    fun addBLEInputDevice(inputDevice: BLEInputDevice){
        //插入输入设备
        println("add ble input device: $inputDevice")
    }

    fun addInputDevice(inputDevice: InputDevice){
        when(inputDevice){
            is BLEInputDevice ->{
                addBLEInputDevice(inputDevice)
            }
            is USBInputDevice ->{
                addUSBInputDevice(inputDevice)
            }
            else ->{
                throw IllegalArgumentException("输入设备类型不支持")
            }
        }
    }
}